<?
// Get recent additions
if (!empty($optID)) {
	// Get recent additions for this option only
	// Get recent addition for the sub category 
	$sqlR = "SELECT *
		FROM ss_resource R
		LEFT JOIN ss_resourceLink L ON R.ID = L.ResourceID
		WHERE L.Sub2CatID = '$SubCatID' AND
		L.OptionID = '$optID' AND
		R.Visible = 1
		ORDER BY DateSubmit DESC
		LIMIT 4";
	$resultR = mysql_db_query($dbname,$sqlR);
	$rowsR = mysql_num_rows($resultR);
	$linkOptID = "&optID=".$optID;
} else {
	// Get recent addition for the sub category 
	$sqlR = "SELECT *
		FROM ss_resource R
		LEFT JOIN ss_resourceLink L ON R.ID = L.ResourceID
		WHERE L.Sub2CatID = '$SubCatID' AND
		R.Visible = 1
		ORDER BY DateSubmit DESC
		LIMIT 4";
	$resultR = mysql_db_query($dbname,$sqlR);
	$rowsR = mysql_num_rows($resultR);
}
?>

<?
if (!empty($rowsR)) {
	include("includes/listResources.php");

}

$totalRows = $totalRows+$rowsR;
?>